﻿@model ListViewModel<CommonSearchValues, IQueryable<UserMemo>>
@{
    ViewBag.Title = "健康备忘录";
    var rds = SiteUser.UserAllRecupers.Where(v => v.GuoQi == false).SelectMany(v => v.QizSubjectObjForDoctors).OrderByDescending(v => v.Timemark).Distinct();
    var items = rds.Select(v => new { RecuperID = v.RecuperID, Title = v.Doctor.UserName }).Distinct().ToList();
    items.Add(new { RecuperID = "", Title = "[私人备忘录]" });
    
}
@using (Ajax.BeginForm(null, new { IsView = false }, new AjaxOptions { HttpMethod = "Post", LoadingElementId = "OnLoadingSpan", UpdateTargetId = "main", OnFailure = "OnSiteError" }))
{
    <p>
        <fieldset class="toolbox">
            <legend>
                <div class="catalog-title">
                    健康备忘录&nbsp;&nbsp;
                    @Ajax.ActionLink("[录入]", "UserMemoEdit", new { }, new AjaxOptions() { LoadingElementId = "OnLoadingSpan", UpdateTargetId = "dialogbox", OnComplete = "showDialog('健康备忘录');", HttpMethod = "Get", InsertionMode = InsertionMode.Replace, OnFailure = "OnSiteError" })
                </div>
            </legend>
            @Html.HiddenFor(m => Model.PageSize)
            <input type="hidden" name="PageIdx" id="qspidx" value="0" />
            内容:@Html.TextBoxFor(m => m.SearchFrom.V1)
            记录时间：@Html.EditorFor(m => m.SearchFrom.V2, "DateTimeStr")
            至：@Html.EditorFor(m => m.SearchTo.V2, "DateTimeStr")
            @Helpers.SubmitButton("查询", "qssubmit")
        </fieldset>
    </p>
}
<table class="width">
    <tr>
        <th>
            标题
        </th>
        <th>
            共享医院
        </th>
        <th>
            备注内容
        </th>
        <th>
            图片内容
        </th>
        <th>
            记录时间
        </th>
        <th>
            创建时间
        </th>
        <th>
        </th>
    </tr>
    @{int dColor = 0;}
    @foreach (var item in Model.Data)
    {
        <tr class="tr-backColor@(dColor++ % 2)">
            <td>@Html.FixStrSuffix(item.Title, 24)
            </td>
            @*<td nowrap="nowrap">@(item.Recuper == null ? string.Empty : (item.Recuper.Hospital.HospCode + " " + item.Recuper.EnHospDay.ToString("yyyy年M月")))*@
            <td nowrap="nowrap">
                @((items.FirstOrDefault(v => v.RecuperID == item.RecuperID) ?? (new { RecuperID="",Title=""})).Title)
            </td>
            <td title="@item.MemoText">@Html.FixStrSuffix(item.MemoText, 32)
            </td>
            <td nowrap="nowrap" width="48px">
                @if (!string.IsNullOrEmpty(item.MemoPic))
                {

                    <a target="_blank" class="previewbtn ui-icon ui-icon-image" style="float:left;" href="@(Url.Action("Img", "Recuper", new { ID = item.MemoPic }))" title="查看" >
                    </a>
                    <a class=""  target="_blank" href="@(Url.Action("Img", "Recuper", new { ID = item.MemoPic }))"  >
                        查看</a>
                }
            </td>
            <td nowrap="nowrap" title="创建时间:@item.CreateTime">@Helpers.DateTimeString(item.Timemark, "yyyy-MM-dd")
            </td>
            <td nowrap="nowrap">@Helpers.DateTimeString(item.CreateTime, "yyyy-MM-dd HH:mm")
            </td>
            <td nowrap="nowrap">
                @Ajax.ActionLink("修改", "UserMemoEdit", new { id = item.ID }, new AjaxOptions() { LoadingElementId = "OnLoadingSpan", UpdateTargetId = "dialogbox", OnComplete = "showDialog('健康备忘录');", HttpMethod = "Get", InsertionMode = InsertionMode.Replace, OnFailure = "OnSiteError" })
            </td>
        </tr>
    }
</table>
@Html.Partial("Pagger", new PaggerViewModel { Act = "SentSms", PageIdx = Model.PageIdx, PageCount = Model.PageCount, ItemCount = Model.ItemCount })
@Html.Partial("TrHilighter")
<script type="text/javascript">
    $(function () {
        $(".previewbtn").tooltip({
            items: "a",
            content: function () {
                var element = $(this);
                var src = element.attr("href");
                return "<img class='imgpreview' width='300px' alt='预览' src='" + src + "?Preview=true'>";
            }
        });
    });
</script>
